<template>
  <div>
    <van-nav-bar style="background:transparent;" :title="title" :left-text="leftText" :left-arrow="leftArrow" @click-left="onClickLeft">
        <template #right>
            <CapsuleCom v-if="rightType=='capsule'" />
            <span v-else @click="onClickRight">{{rightText}}</span>
        </template>
    </van-nav-bar>
  </div>
</template>

<script>
import { Toast } from 'vant';
import CapsuleCom from './capsuleCom'
export default {
  components:{CapsuleCom},
  props:{
    rightType:{
        type:String,
        default:'capsule'
    },
    rightText:{
        type:String,
        default:''
    },
    leftText:{
        type:String,
        default:''
    },
    title:{
        type:String,
        default:''
    },
    leftArrow:{
        type:Boolean,
        default:false,
    },
  },
  data(){
    return{
        
    }
  },
  methods: {
    onClickLeft() {
    //   Toast('返回');
    if(!this.leftArrow){
      this.$router.push('/')
    }else{
      this.$router.go(-1);
    }
   
    },
    onClickRight() {
        // console.log('走了');
     this.$router.push('/addaddress')
    },
  },
};
</script>

<style lang="scss" scoped>
::v-deep .van-nav-bar__text{
      font-size:24px;
      color: #ffffff;
    }
.van-hairline--bottom::after {
    border: 0px;
}
</style>